/* @(#)/system/base//D:\\APEP3\\JavaSourceOutput\BbsBase.java    V1.0
 *
 * Project: APEP
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   wangp    {CREATE_TIME} First release
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2007 Auto-Parts E-Procurement Co., Ltd.
 *        No.251-1 Wuning Road, Shanghai, 200063, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Auto-Parts E-Procurement Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with APEP.
 *
 * Warning:
 * =============================================================================
 * 
 * 
 */

package system.data;

import java.util.Vector;

import framework.core.ConstDefine;
import framework.core.DBConnection;
import framework.core.Field;
import framework.core.Table;
import framework.core.Value;
/*
	Author    :wangp
	CreateTime:{CREATE_TIME}
 */
public class BbsBase extends Table
{
	private static final long serialVersionUID = 1L;

	public static final String TABLE_NAME = "T_BBS";

	private static final String BACKUP_TABLE_NAME = "T_BBS_BACKUP";

	private static final String BACKUP_SEQ_NAME = "S_BBS_BACKUP";


	public static final String ID = "ID";

	public static final String SUBJECT = "SUBJECT";

	public static final String CONTENT = "CONTENT";

	public static final String CREATE_USER_ID = "CREATE_USER_ID";

	public static final String CREATE_TIME = "CREATE_TIME";

	public static final String CREATE_USER = "CREATE_USER";

	public static final String REL_ID = "REL_ID";

	public static final String REPLY_NUM = "REPLY_NUM";

	public static final String BROWER_NUM = "BROWER_NUM";

	public static final String LAST_RE_TIME = "LAST_RE_TIME";

	public static final String LAST_RE_USER = "LAST_RE_USER";

	public static final String RESERVE1 = "RESERVE1";

	public static final String RESERVE2 = "RESERVE2";

	public static final String RESERVE3 = "RESERVE3";


	public static Vector m_fields = null;


	private int m_ID = Value.NULL_INT;  //���

	private String m_SUBJECT = ""; //����

	private String m_CONTENT = ""; //����

	private String m_CREATE_USER_ID = ""; //������

	private String m_CREATE_TIME = ""; //����ʱ��

	private String m_CREATE_USER = ""; //������

	private int m_REL_ID = Value.NULL_INT;  //��jID

	private int m_REPLY_NUM = Value.NULL_INT;  //�ظ�����

	private int m_BROWER_NUM = Value.NULL_INT;  //��4���

	private int m_LAST_RE_TIME = Value.NULL_INT;  //���ظ�ʱ��

	private String m_LAST_RE_USER = ""; //���ظ���

	private String m_RESERVE1 = ""; //RESERVE1

	private String m_RESERVE2 = ""; //RESERVE2

	private String m_RESERVE3 = ""; //RESERVE3



	public int getId()
	{
		return m_ID;
	}
	public void  setId(int v)
	{
		if(getId()==v) {
			return ;
		}
		m_ID = v ;
		markDirty(ID);
	}

	public String getSubject()
	{
		return m_SUBJECT;
	}
	public void  setSubject(String v)
	{
		if(getSubject().equals(v)) {
			return ;
		}
		m_SUBJECT = v ;
		markDirty(SUBJECT);
	}

	public String getContent()
	{
		return m_CONTENT;
	}
	public void  setContent(String v)
	{
		if(getContent().equals(v)) {
			return ;
		}
		m_CONTENT = v ;
		markDirty(CONTENT);
	}

	public String getCreateUserId()
	{
		return m_CREATE_USER_ID;
	}
	public void  setCreateUserId(String v)
	{
		if(getCreateUserId().equals(v)) {
			return ;
		}
		m_CREATE_USER_ID = v ;
		markDirty(CREATE_USER_ID);
	}

	public String getCreateTime()
	{
		return m_CREATE_TIME;
	}
	public void  setCreateTime(String v)
	{
		if(getCreateTime().equals(v)) {
			return ;
		}
		m_CREATE_TIME = v ;
		markDirty(CREATE_TIME);
	}

	public String getCreateUser()
	{
		return m_CREATE_USER;
	}
	public void  setCreateUser(String v)
	{
		if(getCreateUser().equals(v)) {
			return ;
		}
		m_CREATE_USER = v ;
		markDirty(CREATE_USER);
	}

	public int getRelId()
	{
		return m_REL_ID;
	}
	public void  setRelId(int v)
	{
		if(getRelId()==v) {
			return ;
		}
		m_REL_ID = v ;
		markDirty(REL_ID);
	}

	public int getReplyNum()
	{
		return m_REPLY_NUM;
	}
	public void  setReplyNum(int v)
	{
		if(getReplyNum()==v) {
			return ;
		}
		m_REPLY_NUM = v ;
		markDirty(REPLY_NUM);
	}

	public int getBrowerNum()
	{
		return m_BROWER_NUM;
	}
	public void  setBrowerNum(int v)
	{
		if(getBrowerNum()==v) {
			return ;
		}
		m_BROWER_NUM = v ;
		markDirty(BROWER_NUM);
	}

	public int getLastReTime()
	{
		return m_LAST_RE_TIME;
	}
	public void  setLastReTime(int v)
	{
		if(getLastReTime()==v) {
			return ;
		}
		m_LAST_RE_TIME = v ;
		markDirty(LAST_RE_TIME);
	}

	public String getLastReUser()
	{
		return m_LAST_RE_USER;
	}
	public void  setLastReUser(String v)
	{
		if(getLastReUser().equals(v)) {
			return ;
		}
		m_LAST_RE_USER = v ;
		markDirty(LAST_RE_USER);
	}

	public String getReserve1()
	{
		return m_RESERVE1;
	}
	public void  setReserve1(String v)
	{
		if(getReserve1().equals(v)) {
			return ;
		}
		m_RESERVE1 = v ;
		markDirty(RESERVE1);
	}

	public String getReserve2()
	{
		return m_RESERVE2;
	}
	public void  setReserve2(String v)
	{
		if(getReserve2().equals(v)) {
			return ;
		}
		m_RESERVE2 = v ;
		markDirty(RESERVE2);
	}

	public String getReserve3()
	{
		return m_RESERVE3;
	}
	public void  setReserve3(String v)
	{
		if(getReserve3().equals(v)) {
			return ;
		}
		m_RESERVE3 = v ;
		markDirty(RESERVE3);
	}



	public String viewId(DBConnection con) throws Exception
	{
		return Value.view(getId());
	}

	public String viewSubject(DBConnection con) throws Exception
	{
		return Value.view(getSubject());
	}

	public String viewContent(DBConnection con) throws Exception
	{
		return Value.view(getContent());
	}

	public String viewCreateUserId(DBConnection con) throws Exception
	{
		return Value.view(getCreateUserId());
	}

	public String viewCreateTime(DBConnection con) throws Exception
	{
		return Value.view(getCreateTime());
	}

	public String viewCreateUser(DBConnection con) throws Exception
	{
		return Value.view(getCreateUser());
	}

	public String viewRelId(DBConnection con) throws Exception
	{
		return Value.view(getRelId());
	}

	public String viewReplyNum(DBConnection con) throws Exception
	{
		return Value.view(getReplyNum());
	}

	public String viewBrowerNum(DBConnection con) throws Exception
	{
		return Value.view(getBrowerNum());
	}

	public String viewLastReTime(DBConnection con) throws Exception
	{
		return Value.view(getLastReTime());
	}

	public String viewLastReUser(DBConnection con) throws Exception
	{
		return Value.view(getLastReUser());
	}

	public String viewReserve1(DBConnection con) throws Exception
	{
		return Value.view(getReserve1());
	}

	public String viewReserve2(DBConnection con) throws Exception
	{
		return Value.view(getReserve2());
	}

	public String viewReserve3(DBConnection con) throws Exception
	{
		return Value.view(getReserve3());
	}



	protected BbsBase()
	{
	}

	public void fill(BbsPageData pageData) throws Exception
	{

		if( pageData.getId()!=null &&
				!pageData.getId().equals(""))
		{
			setId(Integer.parseInt(pageData.getId()));
		}

		if(pageData.getSubject()!=null)
		{
			setSubject(pageData.getSubject());
		}

		if(pageData.getContent()!=null)
		{
			setContent(pageData.getContent());
		}

		if(pageData.getCreateUserId()!=null)
		{
			setCreateUserId(pageData.getCreateUserId());
		}

		if(pageData.getCreateTime()!=null)
		{
			setCreateTime(pageData.getCreateTime());
		}

		if(pageData.getCreateUser()!=null)
		{
			setCreateUser(pageData.getCreateUser());
		}

		if( pageData.getRelId()!=null &&
				!pageData.getRelId().equals(""))
		{
			setRelId(Integer.parseInt(pageData.getRelId()));
		}

		if( pageData.getReplyNum()!=null &&
				!pageData.getReplyNum().equals(""))
		{
			setReplyNum(Integer.parseInt(pageData.getReplyNum()));
		}

		if( pageData.getBrowerNum()!=null &&
				!pageData.getBrowerNum().equals(""))
		{
			setBrowerNum(Integer.parseInt(pageData.getBrowerNum()));
		}

		if( pageData.getLastReTime()!=null &&
				!pageData.getLastReTime().equals(""))
		{
			setLastReTime(Integer.parseInt(pageData.getLastReTime()));
		}

		if(pageData.getLastReUser()!=null)
		{
			setLastReUser(pageData.getLastReUser());
		}

		if(pageData.getReserve1()!=null)
		{
			setReserve1(pageData.getReserve1());
		}

		if(pageData.getReserve2()!=null)
		{
			setReserve2(pageData.getReserve2());
		}

		if(pageData.getReserve3()!=null)
		{
			setReserve3(pageData.getReserve3());
		}

	}

	public String getTableName()
	{
		return TABLE_NAME;
	}

	public String getBackupTableName()
	{
		return BACKUP_TABLE_NAME;
	}

	public String getBackupSeqName()
	{
		return BACKUP_SEQ_NAME;
	}

	public java.util.Vector getFields()
	{
		if(m_fields==null)
		{
			m_fields = new Vector();

			m_fields.add(new Field(ID,Value.TYPE_INT,true,true,0,"���"));

			m_fields.add(new Field(SUBJECT,Value.TYPE_STRING,false,true,300,"����"));

			m_fields.add(new Field(CONTENT,Value.TYPE_STRING,false,true,4000,"����"));

			m_fields.add(new Field(CREATE_USER_ID,Value.TYPE_STRING,false,true,32,"������"));

			m_fields.add(new Field(CREATE_TIME,Value.TYPE_STRING,false,true,20,"����ʱ��"));

			m_fields.add(new Field(CREATE_USER,Value.TYPE_STRING,false,true,20,"������"));

			m_fields.add(new Field(REL_ID,Value.TYPE_INT,false,true,0,"��jID"));

			m_fields.add(new Field(REPLY_NUM,Value.TYPE_INT,false,true,0,"�ظ�����"));

			m_fields.add(new Field(BROWER_NUM,Value.TYPE_INT,false,true,0,"��4���"));

			m_fields.add(new Field(LAST_RE_TIME,Value.TYPE_INT,false,true,0,"���ظ�ʱ��"));

			m_fields.add(new Field(LAST_RE_USER,Value.TYPE_STRING,false,true,20,"���ظ���"));

			m_fields.add(new Field(RESERVE1,Value.TYPE_STRING,false,true,100,"RESERVE1"));

			m_fields.add(new Field(RESERVE2,Value.TYPE_STRING,false,true,100,"RESERVE2"));

			m_fields.add(new Field(RESERVE3,Value.TYPE_STRING,false,true,100,"RESERVE3"));


		}
		return m_fields;
	}

	public void initObject(java.sql.ResultSet rs) throws Exception
	{

		m_ID = getInt(rs,ID);

		m_SUBJECT = getString(rs,SUBJECT);

		m_CONTENT = getString(rs,CONTENT);

		m_CREATE_USER_ID = getString(rs,CREATE_USER_ID);

		m_CREATE_TIME = getString(rs,CREATE_TIME);

		m_CREATE_USER = getString(rs,CREATE_USER);

		m_REL_ID = getInt(rs,REL_ID);

		m_REPLY_NUM = getInt(rs,REPLY_NUM);

		m_BROWER_NUM = getInt(rs,BROWER_NUM);

		m_LAST_RE_TIME = getInt(rs,LAST_RE_TIME);

		m_LAST_RE_USER = getString(rs,LAST_RE_USER);

		m_RESERVE1 = getString(rs,RESERVE1);

		m_RESERVE2 = getString(rs,RESERVE2);

		m_RESERVE3 = getString(rs,RESERVE3);

		ms_new_flag = ConstDefine.NO;
	}

	public Value get(String f)
	{

		if(f.equalsIgnoreCase(ID))
		{
			return new Value(getId());
		}

		if(f.equalsIgnoreCase(SUBJECT))
		{
			return new Value(getSubject());
		}

		if(f.equalsIgnoreCase(CONTENT))
		{
			return new Value(getContent());
		}

		if(f.equalsIgnoreCase(CREATE_USER_ID))
		{
			return new Value(getCreateUserId());
		}

		if(f.equalsIgnoreCase(CREATE_TIME))
		{
			return new Value(getCreateTime());
		}

		if(f.equalsIgnoreCase(CREATE_USER))
		{
			return new Value(getCreateUser());
		}

		if(f.equalsIgnoreCase(REL_ID))
		{
			return new Value(getRelId());
		}

		if(f.equalsIgnoreCase(REPLY_NUM))
		{
			return new Value(getReplyNum());
		}

		if(f.equalsIgnoreCase(BROWER_NUM))
		{
			return new Value(getBrowerNum());
		}

		if(f.equalsIgnoreCase(LAST_RE_TIME))
		{
			return new Value(getLastReTime());
		}

		if(f.equalsIgnoreCase(LAST_RE_USER))
		{
			return new Value(getLastReUser());
		}

		if(f.equalsIgnoreCase(RESERVE1))
		{
			return new Value(getReserve1());
		}

		if(f.equalsIgnoreCase(RESERVE2))
		{
			return new Value(getReserve2());
		}

		if(f.equalsIgnoreCase(RESERVE3))
		{
			return new Value(getReserve3());
		}

		return null;
	}
	public void set(String f,Value v) throws Exception
	{

		if(f.equalsIgnoreCase(ID))
		{
			setId(v.getInt());
		}

		if(f.equalsIgnoreCase(SUBJECT))
		{
			setSubject(v.getString());
		}

		if(f.equalsIgnoreCase(CONTENT))
		{
			setContent(v.getString());
		}

		if(f.equalsIgnoreCase(CREATE_USER_ID))
		{
			setCreateUserId(v.getString());
		}

		if(f.equalsIgnoreCase(CREATE_TIME))
		{
			setCreateTime(v.getString());
		}

		if(f.equalsIgnoreCase(CREATE_USER))
		{
			setCreateUser(v.getString());
		}

		if(f.equalsIgnoreCase(REL_ID))
		{
			setRelId(v.getInt());
		}

		if(f.equalsIgnoreCase(REPLY_NUM))
		{
			setReplyNum(v.getInt());
		}

		if(f.equalsIgnoreCase(BROWER_NUM))
		{
			setBrowerNum(v.getInt());
		}

		if(f.equalsIgnoreCase(LAST_RE_TIME))
		{
			setLastReTime(v.getInt());
		}

		if(f.equalsIgnoreCase(LAST_RE_USER))
		{
			setLastReUser(v.getString());
		}

		if(f.equalsIgnoreCase(RESERVE1))
		{
			setReserve1(v.getString());
		}

		if(f.equalsIgnoreCase(RESERVE2))
		{
			setReserve2(v.getString());
		}

		if(f.equalsIgnoreCase(RESERVE3))
		{
			setReserve3(v.getString());
		}

	}
	public String toString()
	{
		String msg = "Bbs=\n";
		msg += "(\r\n";

		msg += "    ���(ID)="+get("ID")+"\r\n";

		msg += "    ����(SUBJECT)="+get("SUBJECT")+"\r\n";

		msg += "    ����(CONTENT)="+get("CONTENT")+"\r\n";

		msg += "    ������(CREATE_USER_ID)="+get("CREATE_USER_ID")+"\r\n";

		msg += "    ����ʱ��(CREATE_TIME)="+get("CREATE_TIME")+"\r\n";

		msg += "    ������(CREATE_USER)="+get("CREATE_USER")+"\r\n";

		msg += "    ��jID(REL_ID)="+get("REL_ID")+"\r\n";

		msg += "    �ظ�����(REPLY_NUM)="+get("REPLY_NUM")+"\r\n";

		msg += "    ��4���(BROWER_NUM)="+get("BROWER_NUM")+"\r\n";

		msg += "    ���ظ�ʱ��(LAST_RE_TIME)="+get("LAST_RE_TIME")+"\r\n";

		msg += "    ���ظ���(LAST_RE_USER)="+get("LAST_RE_USER")+"\r\n";

		msg += "    RESERVE1(RESERVE1)="+get("RESERVE1")+"\r\n";

		msg += "    RESERVE2(RESERVE2)="+get("RESERVE2")+"\r\n";

		msg += "    RESERVE3(RESERVE3)="+get("RESERVE3")+"\r\n";

		msg += ")\r\n";
		return msg;
	}
	public void copyBase(BbsBase srcObj)
	{

		setSubject(srcObj.getSubject());

		setContent(srcObj.getContent());

		setCreateUserId(srcObj.getCreateUserId());

		setCreateTime(srcObj.getCreateTime());

		setCreateUser(srcObj.getCreateUser());

		setRelId(srcObj.getRelId());

		setReplyNum(srcObj.getReplyNum());

		setBrowerNum(srcObj.getBrowerNum());

		setLastReTime(srcObj.getLastReTime());

		setLastReUser(srcObj.getLastReUser());

		setReserve1(srcObj.getReserve1());

		setReserve2(srcObj.getReserve2());

		setReserve3(srcObj.getReserve3());

	}

	public String toXml() throws Exception
	{
		String xml = "";
		xml += "<Bbs>";

		xml += "<Id>"+Value.view(getId())+"</Id>";

		xml += "<Subject><![CDATA["+Value.view(getSubject())+"]]></Subject>";

		xml += "<Content><![CDATA["+Value.view(getContent())+"]]></Content>";

		xml += "<CreateUserId><![CDATA["+Value.view(getCreateUserId())+"]]></CreateUserId>";

		xml += "<CreateTime><![CDATA["+Value.view(getCreateTime())+"]]></CreateTime>";

		xml += "<CreateUser><![CDATA["+Value.view(getCreateUser())+"]]></CreateUser>";

		xml += "<RelId>"+Value.view(getRelId())+"</RelId>";

		xml += "<ReplyNum>"+Value.view(getReplyNum())+"</ReplyNum>";

		xml += "<BrowerNum>"+Value.view(getBrowerNum())+"</BrowerNum>";

		xml += "<LastReTime>"+Value.view(getLastReTime())+"</LastReTime>";

		xml += "<LastReUser><![CDATA["+Value.view(getLastReUser())+"]]></LastReUser>";

		xml += "<Reserve1><![CDATA["+Value.view(getReserve1())+"]]></Reserve1>";

		xml += "<Reserve2><![CDATA["+Value.view(getReserve2())+"]]></Reserve2>";

		xml += "<Reserve3><![CDATA["+Value.view(getReserve3())+"]]></Reserve3>";

		xml += "</Bbs>";
		return xml;
	}

}
